class Shape {
    declare _bottomLeft: Point
    declare _topRight: Point
    boundingBox(bottomLeft: Point, topRight: Point): void {
        this._bottomLeft = bottomLeft
        this._topRight = topRight
    }
    CreateManipulator(): Manipulator {
        return new Manipulator()
    }
}

class Manipulator {
}

class TextView {
    private _text: string = ''
    private _originX = 0
    private _originY = 0
    private _width = 0
    private _height = 0
    setText(s: string) {
        this._text = s
    }
    setOriginX(x: number): void {
        this._originX = x
    }
    setOriginY(y: number): void {
        this._originY = y
    }
    setExtentWidth(width: number): void {
        this._width = width
    }
    setExtentHeight(height: number): void {
        this._height = height
    }
    isEmpty(): boolean {
        if (this._text === '') {
            return true
        } else {
            return false
        }

    }
}

class Point {
    declare x: number
    declare y: number
    constructor(x: number, y: number) {
        this.x = x
        this.y = y
    }
}
class TextShape extends Shape {
    declare private _text: TextView
    constructor(t: TextView) {
        super()
        this._text = t
    }
    boundingBox(bottomLeft: Point, topRight: Point): void {
        this._bottomLeft = bottomLeft
        this._topRight = topRight
        this._text.setOriginX(bottomLeft.x)
        this._text.setOriginY(topRight.y)
        this._text.setExtentWidth(topRight.x - bottomLeft.x)
        this._text.setExtentHeight(bottomLeft.y - topRight.y)


    }
    CreateManipulator(): Manipulator {
        return new Manipulator()
    }

    isEmpty(): boolean {
        return this._text.isEmpty()
    }
    setText(t: string) {
        this._text.setText(t)
    }
}

const tv = new TextView()
const ts = new TextShape(tv)
ts.boundingBox(new Point(10, 200), new Point(110, 100))
ts.setText('这是文本内容')
console.log(ts);